package MeteoCal.entity;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @authors Guttadoro, Iommazzo, Saullo
 */
@Embeddable
public class WarningeventPK implements Serializable {
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 45)
    @Column(name = "idUser")
    private String idUser;
    @Basic(optional = false)
    @NotNull
    @Column(name = "idEvent")
    private int idEvent;

    public WarningeventPK() {
    }

    public WarningeventPK(String idUser, int idEvent) {
        this.idUser = idUser;
        this.idEvent = idEvent;
    }

    public String getIdUser() {
        return idUser;
    }

    public void setIdUser(String idUser) {
        this.idUser = idUser;
    }

    public int getIdEvent() {
        return idEvent;
    }

    public void setIdEvent(int idEvent) {
        this.idEvent = idEvent;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idUser != null ? idUser.hashCode() : 0);
        hash += (int) idEvent;
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof WarningeventPK)) {
            return false;
        }
        WarningeventPK other = (WarningeventPK) object;
        if ((this.idUser == null && other.idUser != null) || (this.idUser != null && !this.idUser.equals(other.idUser))) {
            return false;
        }
        if (this.idEvent != other.idEvent) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "MeteoCal.entity.WarningeventPK[ idUser=" + idUser + ", idEvent=" + idEvent + " ]";
    }
    
}
